package com.itheima.day16.task;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Date;

public class Test {
    public static void main(String[] args) throws ParseException {

/*        Date date=new Date();
        long time = date.getTime();
        System.out.println(time);
        date.setTime(70330533);*/
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
     SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String format1 = sdf.format(now);
//        System.out.println(format1);
        LocalDateTime of = LocalDateTime.of(2020,11,11,11,11,11);
        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String format = of.format(dateTimeFormatter1);
        String format1 = now.format(dateTimeFormatter1);
        LocalDateTime parse1 = LocalDateTime.parse(format, dateTimeFormatter1);
        Date parse = sdf.parse(format1);
        System.out.println(format1);
        System.out.println(parse);
        System.out.println(format);
        System.out.println(parse1);


    }
}
